using System;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data;
using Googler.BLL;

namespace Googler.DAL
{
	/// <summary>
	/// Summary description for DALHelper.
	/// </summary>
	public interface IDataAcessLayerBaseInterface
	{
		void OpenConnection();
		void CloseConnection();
		object ExecuteScalar(string procName,params object[] Params);
		object ExecuteScalar(string query);
		void ExecuteNonQuery(string procName,params object[] Params);
        void ExecuteNonQuery(string procName);
		IDataReader ExecuteReader(string procName,params object[] Params);
		IDataReader ExecuteReader(string query);
		DataSet ExecuteDataSet(string qurey);
		DataSet ExecuteDataSet(string procName,params object[] Params);
		DataTable ExecuteDataTable(string qurey);
		DataTable ExecuteDataTable(string procName,params object[] Params);
	}
    public class DALHelper
    {

        public static IDataAcessLayerBaseInterface GetDataAccessLayer()
        {
            Type trp = Type.GetType(Globals.DataAccessLayerType);//MsSql, any
            IDataAcessLayerBaseInterface dc = (IDataAcessLayerBaseInterface)Activator.CreateInstance(trp);
            return (dc);
        }
        public static IDataAcessLayerBaseInterface GetDataAccessLayer(string connectionStringKey)
        {
            Type type1 = Type.GetType(Globals.DataAccessLayerType);
            return (IDataAcessLayerBaseInterface)Activator.CreateInstance(type1, new object[] { Globals.GetConnectionString(connectionStringKey) });
        }
    }



}
